﻿#pragma warning(disable: 4477)
#pragma warning(disable: 4996)
#pragma warning(disable: 6031)
#pragma warning(disable: 6054)
/*
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>

typedef double Real;
const Real PI = 3.14159265359;

char* days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

typedef struct TContext_s
{
	int k;
	int n;
	char* pv[100];
	char v[100][11];
}TContext;

TContext context;

void read_data(TContext* ctx)
{
	scanf("%d", &ctx->n);
}

int find(char* s)
{
	for (int i = 0; i < 7; ++i)
		if (strcmp(days[i], s) == 0)
			return i+1;
	return -1;
}

void do_task(TContext * ctx)
{
	char buf[255];
	

	for (int i = 0; i < ctx->n; ++i)
	{
		scanf("%s", buf);
		printf("%d\n", find(buf));
	}
}

void solve(TContext* ctx)
{
	read_data(ctx);
	do_task(ctx);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-133.txt", "r", stdin);
	solve(&context);
	return 0;
}
